Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: start converting unit tests over to ESM-friendly tests #562

Merged
merged 1 commit into from
Nov 13, 2023

Conversation

rossiam
Copy link
Collaborator

@rossiam rossiam commented Nov 9, 2023

Module Mocking in ESM

  • run unit tests with --experimental-vm-modules option (package.json)
  • updated inquirer dependency to ES module-only version 9 (package.json)
  • temporarily disabled running unit tests except a few which have been converted (jest.config.ts)
  • converted a small starter-set of unit tests to ESM format
  • refactored api-helpers.test.ts somewhat
    • removed top-level describe
    • passed mock SmartThingClient into tested functions rather than spying on endpoints
    • singular withLocation and withNameAndLocation proxies to withLocations and withNamesAndLocations no longer use spy. (I was unable to get this to work.)

Checklist

  • I have read the CONTRIBUTING document
  • My code follows the code style of this project (npm run lint produces no warnings/errors)

Copy link

changeset-bot bot commented Nov 9, 2023

⚠️ No Changeset found

Latest commit: 751e5e1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@rossiam rossiam force-pushed the unit-test-reset branch 2 times, most recently from b590077 to 246560b Compare November 13, 2023 17:02
@rossiam rossiam merged commit e49e767 into SmartThingsCommunity:yargs Nov 13, 2023
@rossiam rossiam deleted the unit-test-reset branch November 13, 2023 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants